#pragma once

#include <string>
#include <memory>
#include "../storage/user_storage.hpp"

namespace service {

class UserService {
public:
    explicit UserService();
    ~UserService();
    bool register_user(const std::string& username, const std::string& password);
    bool login_user(const std::string& username, const std::string& password);
    void logout_user(const std::string& username);
    bool is_user_online(const std::string& username);

private:
    std::string hash_password(const std::string& password);
    std::string generate_session_token();

    bool is_user_exist(const std::string& username);
    bool verify_session(const std::string& username, const std::string& session_token);
    
    std::shared_ptr<storage::IUserStorage> user_storage_;
};

} // namespace service